[XEND] More fixes for HVM device configuration parsing
authorAlastair Tse <atse@xensource.com>
Fri, 1 Dec 2006 11:07:22 +0000 (11:07 +0000)
committerAlastair Tse <atse@xensource.com>
Fri, 1 Dec 2006 11:07:22 +0000 (11:07 +0000)
Removed duplicated acpi option, added missing stdvga option. Do not
output empty configurations in image sxp. Remove bug with vcpus
passing in device model.

Signed-off-by: Alastair Tse <atse@xensource.com>
tools/python/xen/xend/XendConfig.py
tools/python/xen/xend/image.py

index 3bb0ba4cd9ceef353e6b288011643f7dbdbdd3c6..846aebda0266dcbb52232630543d87e2274152a0 100644 (file)
@@ -185,7 +185,6 @@ LEGACY_IMAGE_HVM_CFG = [
     ('vncconsole', int),
     ('pae', int),
     ('apic', int),
-    ('acpi', int),
 ]
 
 LEGACY_IMAGE_HVM_DEVICES_CFG = [
@@ -196,7 +195,8 @@ LEGACY_IMAGE_HVM_DEVICES_CFG = [
     ('isa', str),
     ('keymap', str),    
     ('localtime', str),    
-    ('serial', str),    
+    ('serial', str),
+    ('stdvga', int),
     ('soundhw', str),
     ('usb', str),
     ('usbdevice', str),    
@@ -987,12 +987,12 @@ class XendConfig(dict):
 
         if 'hvm' in self['image']:
             for arg, conv in LEGACY_IMAGE_HVM_CFG:
-                if self['image']['hvm'].has_key(arg):
+                if self['image']['hvm'].get(arg):
                     image.append([arg, self['image']['hvm'][arg]])
 
         if 'hvm' in self['image'] and 'devices' in self['image']['hvm']:
             for arg, conv in LEGACY_IMAGE_HVM_DEVICES_CFG:
-                if self['image']['hvm']['devices'].has_key(arg):
+                if self['image']['hvm']['devices'].get(arg):
                     image.append([arg,
                                   self['image']['hvm']['devices'][arg]])
 
index 31194c7a73bd827af5ba7f2360044f6bfa827738..8d2aab1836db2f137348b60fb309f1be66df91c7 100644 (file)
@@ -270,8 +270,9 @@ class HVMImageHandler(ImageHandler):
         self.dmargs += self.configVNC(imageConfig)
 
         self.pae  = imageConfig['hvm'].get('pae', 0)
-        self.acpi  = imageConfig['hvm'].get('acpi', 0)
         self.apic  = imageConfig['hvm'].get('apic', 0)
+        self.acpi  = imageConfig['hvm']['devices'].get('acpi', 0)
+        
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
@@ -310,8 +311,6 @@ class HVMImageHandler(ImageHandler):
         
         for a in dmargs:
             v = hvmDeviceConfig.get(a)
-            if a == 'vcpus':
-                v = hvmDeviceConfig.get('vcpus_number')
 
             # python doesn't allow '-' in variable names
             if a == 'stdvga': a = 'std-vga'